<div id="video">
	<div class="aboutVote">
		<span>
			เตรียมตัวต้องมนต์สะกดกันไว้ให้ดีกับงานประกาศ<br />
			ผลรางวัลทางดนตรีแห่งปี “You2Play Awards 2014”<br />
			ที่จะร่ายเวทย์แห่ง เสียงเพลง สีสัน และความมันส์<br />
			ขั้นสุด ให้คุณหฤหรรษ์กันสุดขั้ว 11 กุมภาพันธ์ นี้้<br />
			ที่ รอยัล พารากอน ฮอลล์			
		</span>
		<a href="<?php echo $award_url.'about';?>" target="_self" class="btnMore"></a>
	</div>
	<div class="aboutPlayer">
		<div id="vdoPlayer">
			<?php if($this->agent->is_mobile()):?>
				<video id='my_video' controls preload='none'></video>
			<?php endif;?>
		</div>		
	</div>
	<div class="clear"></div>
	<div id="video_list">
		<div class="videoStamp"></div>
		<?php foreach($dataXML as $value):?>			
			<div class="videoListBg">
				<a href="javascript:void(0);" onclick="javascript:playThis('<?php echo $value->file_url;?>');">
					<img src="<?php echo $value->image_url;?>" border="0" width="180" height="112"/>
					<p><?php echo $value->description;?></p>
				</a>		
			</div>
		<?php endforeach;?>		
	</div>	
	<div id="video_comment">
		<!--Social Nav-->
		<div id="socialNav">
			<div class="floatLeft">
				<div class="fb-like" data-href="<?php echo $award_url.'vdo';?>" colorscheme="dark" data-show-faces="false" data-share="false" data-show-faces="false" data-layout="button_count"></div>
			</div>
			<div class="floatRight">
				<a href="https://twitter.com/share" class="twitter-share-button" data-lang="th">ทวีต</a>
				<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
			</div>				
			<div class="floatRight">
				<div class="fb-share-button" data-href="<?php echo $award_url.'vdo';?>" data-type="button"></div>
			</div>
		</div>
		<a href="<?php echo $award_url."ment";?>"><?php echo image_asset($asset_award_image_path.'banner_ment.png','',array('width' => 571,'height' => 103));?></a>
		<!--Comment Facebook Plugin-->
		<div class="fb-comments" data-href="<?php echo $award_url.'video';?>" colorscheme="dark" data-width="571" data-num-posts="20"></div>			
	</div>
	<div class="clear"></div>
</div>
<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		//Set Video Source
		var url = "<?php echo image_asset_url($asset_award_upload_path.'home.mp4');?>";			
		var is_mobile = '<?php echo $this->agent->is_mobile();?>';	
		if(is_mobile){
			$('#my_video').append("<source id='mp4' src='"+url+"' type='video/mp4'>");
			$('#my_video').attr('src',""+url+"");
			$('#my_video').attr('width',540);
			$('#my_video').attr('height',280);			
			// videoplaza sdk, 4 sec time-out, callback function
			loadScript("<?php echo js_asset_url('media/html5-sdk-1.0.12.15.1-ea.min.js');?>",4000,initVideoplaza);
			// *** START - videoplaza plugin config ***
			vpConfig = {
				vphost : 'http://th-pmdplus.videoplaza.tv',
				category : 'award',
				tags : ['standard'],
				flags: [],
				playbackPosition: [] // mid-roll cue points, if any.
			}
			// *** END - videoplaza plugin config ***
			//Auto Play && Loop
			$('#my_video').attr('autoplay','autoplay');					
		} else {	
			jwplayer("vdoPlayer").setup({
				autostart: true,
		      	flashplayer: "<?php echo js_asset_url('media/player.swf');?>",
		      	width: 540,
		      	height: 280,
				file: ""+url+"",
		      	plugins: "<?php echo js_asset_url('media/vp_plugin.swf');?>",
		      	vpdomain: "http://th-pmdplus.videoplaza.tv",
		      	vpshares: "award",
		      	vptags: ""
			});		
		}				
	});	
})(jQuery);

function playThis(url)
{
		var is_mobile = '<?php echo $this->agent->is_mobile();?>';
		if(is_mobile){
			//Set Video Source
			$('#my_video').empty().append("<source id='mp4' src='"+url+"' type='video/mp4'>");
			$('#my_video').attr('src',""+url+"");
			$('#my_video').attr('width',540);
			$('#my_video').attr('height',280);			
			// videoplaza sdk, 4 sec time-out, callback function
			loadScript("<?php echo js_asset_url('media/html5-sdk-1.0.12.15.1-ea.min.js');?>",4000,initVideoplaza);
			// *** START - videoplaza plugin config ***
			vpConfig = {
				vphost : 'http://th-pmdplus.videoplaza.tv',
				category : 'award',
				tags : ['standard'],
				flags: [],
				playbackPosition: [] // mid-roll cue points, if any.
			}
			// *** END - videoplaza plugin config ***
			//Auto Play && Loop
			$('#my_video').attr('autoplay','autoplay');							
		} else {
			jwplayer("vdoPlayer").setup({
				autostart: true,
				flashplayer: "<?php echo js_asset_url('media/player.swf');?>",
			 	width: 540,
			 	height: 280,
				file: ""+url+"",
				events: {
					onComplete: function(event) {
						jwplayer().play();
					}
				},
			  	plugins: "<?php echo js_asset_url('media/vp_plugin.swf');?>",
			  	vpdomain: "http://th-pmdplus.videoplaza.tv",
			   	vpshares: "award",
			   	vptags: "",
               	provider: "http",
        		startparam: "starttime"					
			});			
		}
}
</script>